//
//  SHBindCardViewController.m
//  JiFengDaRen
//
//  Created by SH_iOS on 2017/7/18.
//  Copyright © 2017年 SH_iOS. All rights reserved.
//
#import "CustomView.h"
#import "BluetoothCell.h"
#import "ZSYPopoverListView.h"
#import "SHTextFieldCell.h"
#import "SHLabelCell.h"
#import "JMBindingCell.h"
#import "SHNerAreaList.h"
#import "SHBankInfoModel.h"
#import "PictureExampleViewController.h"
#import "PhotoViewController.h"
#import "SHBindCardViewController.h"
#import "TDBankSearchViewController.h"

@interface SHBindCardViewController ()<UITableViewDelegate,UITableViewDataSource,JMBindingCellDelegate,SHNerAreaListDelegate,ZSYPopoverListDelegate,ZSYPopoverListDatasource,PhotoViewControllerDelegate>

@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)SHTextFieldCell *bankCardNoCell;//银行卡卡号
@property(nonatomic,strong)SHTextFieldCell *phoneCell;//身份证号
@property(nonatomic,strong)SHLabelCell *provinceCell;//省份
@property(nonatomic,strong)SHLabelCell *cityCell;//城市
@property(nonatomic,strong)SHLabelCell *bankNameCell;//银行名称
@property(nonatomic,strong)SHLabelCell *branchBankNameCell;//支行名称
@property(nonatomic,strong)JMBindingCell *bindingCell;//拍照
@property(nonatomic,strong)CustomView *customView;

@property(nonatomic,strong)NSString *cardNo;//卡号
@property(nonatomic,strong)NSString *custMobile;//手机号
@property(nonatomic,strong)NSString *province;//省份名字
@property(nonatomic,strong)NSString *city;//城市名字
@property(nonatomic,strong)NSString *provinceId;//省份编号
@property(nonatomic,strong)NSString *cityId;//城市编号
@property(nonatomic,strong)NSString *bankName;//银行名称
@property(nonatomic,strong)NSString *branchBankName;//支行名称
@property(nonatomic,strong)NSString *cnapsCode;//支行号--联行号
@property(nonatomic,strong)NSString *cardFrontBase64;//银行卡正面base64
@property(nonatomic,strong)NSString *cardBackBase64;//银行卡反面base

@property(nonatomic,strong)NSString *cardFrontUrl;//银行卡正面URL
@property(nonatomic,strong)NSString *cardBackUrl;//银行卡反面URL




@property(nonatomic,copy) NSString *type;//1 绑卡 2 修改银行卡信息
@property(nonatomic,strong)NSMutableArray *bankNameListArr;
@property(nonatomic,strong)NSMutableArray *subBankArray;

@end

@implementation SHBindCardViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBar.hidden = NO;
}


- (NSMutableArray *)bankNameListArr{
    if (!_bankNameListArr) {
        _bankNameListArr = [NSMutableArray arrayWithCapacity:0];
    }
    return _bankNameListArr;
}
- (NSMutableArray *)subBankArray{
    if (!_subBankArray) {
        _subBankArray = [NSMutableArray arrayWithCapacity:0];
    }
    return _subBankArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = [self getNavTitle:self.usingType];
    SHLog(@"用途===%ld",(long)self.usingType);
    [self configUI];
    // Do any additional setup after loading the view.
}
#pragma mark - 获取标题
- (NSString *)getNavTitle:(NSInteger )type{
    NSString *navTitle;
    switch (type) {
        case 1:
        case 2:
            
            navTitle=  @"添加银行卡";
            break;
        case 3:
        case 4:
        case 5:
            
            navTitle = @"修改银行卡";
            break;
            
            
    }
    return  navTitle;
}



#pragma mark -- 初始化界面
- (void)configUI{
    
    self.view.backgroundColor = KBASEBGCOLOR;
    [self tableView];
    
    
}


- (UITableView *)tableView{
    
    
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, KScreenWidth, KScreenHeight - KNAVIGATIONBARHEIGHT) style:UITableViewStyleGrouped];
        _tableView.dataSource = self;
        _tableView.delegate  = self;
        _tableView.scrollEnabled = NO;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_tableView];
        
    }
    return  _tableView;
}


#pragma mark --- UITableView && Delegate Datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return   7;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    if (indexPath.row == 0){
        self.bankCardNoCell = [[SHTextFieldCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.bankCardNoCell.labelText = @"银行卡号";
        self.bankCardNoCell.contentTf.keyboardType = UIKeyboardTypeNumberPad;
        self.bankCardNoCell.placeholder = @"输入本人银行卡卡号";
        if(self.usingType == SHCashCardUsingTypeShAgainAuthFouthStatus){
            self.bankCardNoCell.contentTf.text = self.bankCardModel.bank_card_code;
        }
        self.bankCardNoCell.selectionStyle = UITableViewCellSelectionStyleNone;
        return self.bankCardNoCell;
    }else if (indexPath.row == 1){
        
        self.phoneCell = [[SHTextFieldCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.phoneCell.labelText = @"手机号";
        self.phoneCell.contentTf.keyboardType = UIKeyboardTypeNumberPad;
        self.phoneCell.placeholder = @"请输入银行卡预留手机号";
        self.phoneCell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return self.phoneCell;
    }else if (indexPath.row == 2){
        
        self.provinceCell = [[SHLabelCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.provinceCell.labelText = @"银行卡所属省份";
        self.provinceCell.placeholder = @"请选择";
        self.provinceCell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return  self.provinceCell;
    }else if (indexPath.row == 3){
        
        self.cityCell = [[SHLabelCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.cityCell.labelText = @"银行卡所属城市";
        self.cityCell.placeholder = @"请选择";
        self.cityCell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return  self.cityCell;
    }else if (indexPath.row == 4){
        
        self.bankNameCell = [[SHLabelCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.bankNameCell.labelText = @"银行名称";
        self.bankNameCell.placeholder = @"请选择银行名称";
        self.bankNameCell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return self.bankNameCell;
        
    }else if(indexPath.row == 5){
        
        self.branchBankNameCell = [[SHLabelCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.branchBankNameCell.labelText = @"支行名称";
        self.branchBankNameCell.placeholder = @"请选择支行名称";
        
        self.branchBankNameCell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return self.branchBankNameCell;
        
    }else{
        self.bindingCell = [[JMBindingCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        self.bindingCell.selectionStyle =    UITableViewCellSelectionStyleNone;
        self.bindingCell.vc = self;
        self.bindingCell.delegate = self;
        return self.bindingCell;
        
    }
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row < 6) {
        return __I6Height(44.f);
        
    }else{
        return  KScreenWidth;
        
    }
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return __I6Height(30);
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, __I6Height(30))];
    view.backgroundColor = KBASEBGCOLOR ;
    view.layer.borderColor = KLINECOLOR.CGColor;
    UILabel *titleLabel = [SHLabel labelWithTextFont:13 textColor:KSHTEXTCOLOR textAlignment:NSTextAlignmentLeft];
    titleLabel.frame = CGRectMake(__I6Width(10), 0, __I6Width(200), __I6Height(30));
    titleLabel.text = @"*请绑定持卡人本人的借记卡";
    [view addSubview:titleLabel];
    view.layer.borderWidth = 0.5;
    return view;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 2 || indexPath.row == 3) {
        if (self.bankCardNoCell.contentTf.text.length == 0) {
            [self.view makeToast:@"请填写银行卡卡号！" duration:1.5 position:@"center"];
            return;
        }
        
        if (self.phoneCell.contentTf.text.length == 0) {
            [self.view makeToast:@"请填写手机号" duration:1.5 position:@"center"];
            return;
        }
        
        [self showAreaList];
    }else if (indexPath.row == 4){
        
        if (self.bankCardNoCell.contentTf.text.length == 0) {
            [self.view makeToast:@"请填写银行卡卡号！" duration:1.5 position:@"center"];
            return;
        }
        
        if (self.phoneCell.contentTf.text.length == 0) {
            [self.view makeToast:@"请填写手机号" duration:1.5 position:@"center"];
            return;
        }
        
        if ([self.provinceCell.contentLabel.text isEqualToString:@"请选择"]) {
            [self.view makeToast:@"请选择省份,城市" duration:1.5 position:@"center"];
            return;
        }
        
        
        
        self.branchBankName = @"";
        self.cnapsCode= @"";
        self.branchBankNameCell.labelText = @"请选择";
        
        [SHUserCenterHttp getBankCnapsCodeBankProId:self.provinceId bankCityId:self.cityId success:^(NSMutableArray *bankInfoArray) {
            if (self.bankNameListArr.count > 0) {
                [self.bankNameListArr removeAllObjects];
            }
            for (SHBankInfoModel *bankInfoModel in bankInfoArray) {
                if (![self.bankNameListArr containsObject:bankInfoModel.bankName]) {
                    [self.bankNameListArr addObject:bankInfoModel.bankName];
                    
                }
            }
            
            
            ZSYPopoverListView *listView = [[ZSYPopoverListView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth - __I6Width(40), KScreenHeight - __I6Height(200))];
            listView.tag = 100;
            listView.titleName.text = @"请选择银行名称";
            listView.datasource = self;
            listView.delegate = self;
            [listView show];
            
        } complection:^(id result) {
            
        } ];
        
    }else if (indexPath.row == 5){
        
        
        if (self.bankName.length == 0) {
            [self.view makeToast:@"请选择银行" duration:2.0f position:@"center"];
            return;
        }
        
        
        [SHUserCenterHttp getBankCnapsCodeBankProId:self.provinceId bankCityId:self.cityId success:^(NSMutableArray *bankInfoArray) {
            
            
            TDBankSearchViewController * search = [[TDBankSearchViewController alloc]initWithNibName:@"TDBankSearchViewController" bundle:[NSBundle bundleWithPath:SRCBUNDLEPATH]];
            search.delegate = self;
            if (self.subBankArray.count > 0) {
                [self.subBankArray removeAllObjects];
            }
            for (int i = 0; i < bankInfoArray.count; i ++) {
                SHBankInfoModel *info = bankInfoArray[i];
                
                if ([info.bankName hasPrefix:_bankName]) {
                    
                    [self.subBankArray addObject:info];
                }
            }
            
            
            search.dataArray = self.subBankArray.copy;
            [self.navigationController pushViewController:search animated:YES];
            __weak  typeof(self) weakSelf = self;
            search.PopMyBlock = ^(NSString *branchName, NSString *cnaps_code) {
                
                
                
                weakSelf.branchBankName = branchName;
                weakSelf.cnapsCode = cnaps_code;
                [weakSelf.branchBankNameCell contentLabelText:branchName];
                
            };
        } complection:^(id result) {
            
        } ];
        
    }
    
    
}
#pragma mark - 显示地址列表
- (void)showAreaList{
    
    [self.view endEditing:YES];
    SHNerAreaList *areaList = [[SHNerAreaList alloc]init];
    areaList.delegate = self;
    [areaList show];
    
}

#pragma mark - 地址选择代理
- (void)pickerArea:(SHNerAreaList *)pickerArea province:(NSString *)province city:(NSString *)city  provinceId:(NSString *)provinceId cityId:(NSString *)cityId  area:(NSString *)area{
    [self.provinceCell contentLabelText:province];
    [self.cityCell contentLabelText:city];
    self.province = province;
    self.city = city;
    self.provinceId = provinceId;
    self.cityId = cityId;
    SHLog(@"%@----%@",province,city);
    
    
    
    
    
}


#pragma mark - 显示银行名称
- (NSInteger)popoverListView:(ZSYPopoverListView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.bankNameListArr.count;
}

- (UITableViewCell *)popoverListView:(ZSYPopoverListView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"identifier";
    BluetoothCell *cell = [tableView dequeueReusablePopoverCellWithIdentifier:identifier];
    if (nil == cell)
    {
        cell = [[BluetoothCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.bluetoothLabel.text = self.bankNameListArr[indexPath.row];
    return cell;
}
- (CGFloat)popoverListView:(ZSYPopoverListView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return __I6Height(44);
}


- (void)popoverListView:(ZSYPopoverListView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.bankNameListArr.count > 0) {
        self.bankName = self.bankNameListArr[indexPath.row];
        [self.bankNameCell contentLabelText:self.bankName];
    }
}


/**
 *  <#Description#>
 *
 *  @return <#return value description#>
 */
#pragma mark ----上传照片
-(void)updatePhoto:(JMBindingCell *)cell customView:(CustomView *)customView
{
    self.customView = customView;
    PictureExampleViewController *picture = [[PictureExampleViewController alloc]init];
    picture.index = (int)customView.tag;
    [self.navigationController pushViewController:picture animated:YES];
    
}



#pragma mark -- 自定义相机返回图片代理
- (void)getUIImageFromPhotoViewController:(PhotoViewController *)photoViewController image:(UIImage *)image{
    

    
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    NSData *imageData = UIImageJPEGRepresentation(image,0.5);
    [SHQiniuManager qiniuUploadImage:image scale:YES size:CGSizeMake(400, 400) complete:^(NSString *qnImageUrl) {
        _customView.icon.image = image;
        switch (_customView.tag) {
                case 1003:
                self.cardFrontUrl = qnImageUrl;
                self.cardFrontBase64 = [imageData base64EncodedString];
                break;
                case 1004:
                self.cardBackUrl = qnImageUrl;
                self.cardBackBase64 = [imageData base64EncodedString];
                break;
                
            default:
                break;
        }
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        
    }];
    
    
    
    
   
    
}

/**
 *  <#Description#>
 *
 *  @return <#return value description#>
 */
#pragma mark --- 绑定银行卡
-(void)jmForJMBinding{
    
    
    self.cardNo = self.bankCardNoCell.contentTf.text;
    self.custMobile = self.phoneCell.contentTf.text;
    
    
    
    
    if (self.cardNo.length == 0) {
        [self.view makeToast:
         @"请输入银行卡号" duration:1.f position:@"center"];
        return;
    }else{
        
        if (![SHHelper checkCardNo:self.cardNo]) {
            [self.view makeToast:
             @"请输入正确的银行卡号" duration:1.f position:@"center"];
            return;
        }
    }
    if (self.phoneCell.contentTf.text.length == 0) {
        [self.view makeToast:@"请输入银行手机预留好" duration:1.f position:@"center"];
        return;
    }
    
    
    if (!self.provinceId) {
        [self.view makeToast:@"请选择银行卡所属省份" duration:1.f position:@"center"];
        return;
    }
    
    if (!self.cityId) {
        [self.view makeToast:@"请选择银行卡所属城市" duration:1.f position:@"center"];
        return;
    }
    
    
    if(self.cnapsCode.length == 0){
        [self.view makeToast:@"请选择支行" duration:1.f position:@"center"];
        return;
        
    }
    
    if(self.cardFrontUrl.length == 0){
        [self.view makeToast:@"请输上传银行卡正面照" duration:1.f position:@"center"];
        return;
        
    }
    
    if(self.cardBackUrl.length == 0){
        [self.view makeToast:@"请输上传银行卡反面照" duration:1.f position:@"center"];
        return;
        
    }
    
    if (self.usingType == SHCashCardUsingTypeShAddCard) {//添加首瀚新卡
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [SHUserCenterHttp postBankCardInfoWithOrgCardCode:@"" bankCardCode:self.cardNo bankCardFrontPic:self.cardFrontUrl  bankCardBackPic:self.cardBackUrl province:self.province city:self.city bankName:self.bankName phone:self.custMobile cnapsCode:self.cnapsCode subBankName:self.branchBankName  bankCardType:11 usingChoices:1 success:^(id result) {
            
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self refeshCashCardPop];
            
        } complection:^(id result) {
            [self refeshCashCardPop];
            
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
        } failure:^(id erro) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
        }];
        
        
        
    }else if(self.usingType == SHCashCardUsingTypeSdAddCard){//添加杉德卡
        
        
        NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
        [dict setValue:self.cardNo forKey:@"bank_card_code"];
        [dict setValue:self.cardFrontUrl forKey:@"bank_card_front_pic"];
        [dict setValue:self.cardBackUrl forKey:@"bank_card_back_pic"];
        [dict setValue:self.province forKey:@"province"];
        [dict setValue:self.city forKey:@"city"];
        [dict setValue:self.bankName forKey:@"bank_name"];
        [dict setValue:self.custMobile forKey:@"phone"];
        [dict setValue:self.cnapsCode forKey:@"cnaps_code"];
        [dict setValue:self.branchBankName forKey:@"sub_bank_name"];
        [dict setValue:@(1) forKey:@"using_choices"];
        
        [MyDataService requestAFURL:KBankCard httpMethod:@"POST" params:dict data:nil complection:^(id result) {
            if ([result[@"success"] isEqualToNumber:@(1)]) {
                
                [MBProgressHUD showHUDAddedTo:self.view animated:YES];
//                [TDHttpEngine requestForUpBankCardWithCustId:[TDUser defaultUser].custId custMobile:[TDUser defaultUser].custLogin OperType:@"1" oldCardNo:@"" cardNo:self.cardNo cardFront:self.cardFrontBase64 cardBack:self.cardBackBase64 provinceId:self.provinceId cityId:self.cityId cnapsCode:self.cnapsCode complete:^(BOOL succeed, NSString *msg, NSString *cod) {
//                    [MBProgressHUD hideHUDForView:self.view animated:YES];
//
//                    SHLog(@"sd银行卡信息:%@",msg);
//                    [self.view makeToast:msg duration:2.0f position:@"center"];
//
//
//                    if (succeed) {
//
//                        [self refeshCashCardPop];
//
//
//                    }
//                    else{
//
//
//                    }
//
//                }];
//
            }else{
                [self.view makeToast:result[@"data"] duration:2 position:@"center"];
                
            }
        } failure:^(id erro) {
            
            
            
            
            
            
            
        }];
        
        
        
        
        
        
        
        
        
        
    }else if(self.usingType == SHCashCardUsingTypeShAgainAuthFouthStatus){//四要素认证失败，再次修改卡信息，认证
        
        
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        [SHUserCenterHttp postBankCardInfoWithOrgCardCode:self.bankCardModel.bank_card_code bankCardCode:self.cardNo bankCardFrontPic:self.cardFrontUrl  bankCardBackPic:self.cardBackUrl province:self.province city:self.city bankName:self.bankName phone:self.custMobile cnapsCode:self.cnapsCode subBankName:self.branchBankName  bankCardType:11 usingChoices:1 success:^(id result) {
            
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self refeshCashCardPop];
            
        } complection:^(id result) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
        } failure:^(id erro) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
        }];
        
        
        
        
    }else if(self.usingType == SHCashCardUsingTypeSdPutCard){//修改杉德卡
        
        /*
        if ([self.cardNo isEqualToString:self.bankCardModel.bank_card_code]) {
            [self.view makeToast:@"旧卡和新卡不能是同一张卡" duration:2.f position:@"center"];
            return;
        }
        NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
        [dict setValue:self.cardNo forKey:@"bank_card_code"];
        [dict setValue:self.cardFrontUrl forKey:@"bank_card_front_pic"];
        [dict setValue:self.cardBackUrl forKey:@"bank_card_back_pic"];
        [dict setValue:self.province forKey:@"province"];
        [dict setValue:self.city forKey:@"city"];
        [dict setValue:self.bankName forKey:@"bank_name"];
        [dict setValue:self.custMobile forKey:@"phone"];
        [dict setValue:self.cnapsCode forKey:@"cnaps_code"];
        [dict setValue:self.branchBankName forKey:@"sub_bank_name"];
        [dict setValue:@(1) forKey:@"using_choices"];
        
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        
        [TDHttpEngine requestForUpBankCardWithCustId:[TDUser defaultUser].custId custMobile:[TDUser defaultUser].custLogin OperType:@"2" oldCardNo:self.bankCardModel.bank_card_code cardNo:self.cardNo cardFront:self.cardFrontBase64 cardBack:self.cardBackBase64 provinceId:self.provinceId cityId:self.cityId cnapsCode:self.cnapsCode complete:^(BOOL succeed, NSString *msg, NSString *cod) {
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            SHLog(@"sd银行卡信息:%@",msg);
            [self.view makeToast:msg duration:2.0f position:@"center"];
            
            
            if (succeed) {
                
                [MyDataService requestAFURL:[NSString stringWithFormat:KChangeBankCard,self.bankCardModel.bank_card_code] httpMethod:@"PUT" params:dict data:nil complection:^(id result) {
                    SHLog(@"%@",result);
                    
                    BOOL success = [result[@"success"] boolValue];
                    if (success) {
                        
                        NSDictionary *para = @{@"is_auth":@(5)};
                        [MyDataService requestAFURL:[NSString stringWithFormat:KChangeBankCard,self.cardNo]   httpMethod:@"PUT" params:para data:nil complection:^(id result) {
                            [self refeshCashCardPop];
                            
                            
                        } failure:^(id erro) {
                            
                        }];
                        
                    }else{
                        
                        [self.view makeToast:result[@"data"] duration:1 position:@"center"];
                    }
                    
                    
                } failure:^(id erro) {
                    
                    
                }];
                
                
                
            }else{
                
                
            }
            
        }];
        */
        
    }
    
    
}


- (void)refeshCashCardPop{
    
    dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5/*延迟执行时间*/ * NSEC_PER_SEC));
    
    dispatch_after(delayTime, dispatch_get_main_queue(), ^{
        
        [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshCashCardNotification" object:nil];
        [self.navigationController popViewControllerAnimated:YES];
        
        
    });
    
}

@end
